package com.springboot.erp.Tool;

import com.springboot.erp.entity.Entry_Warehouse;

import java.io.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class Tool {
    //判断goods_no是否在某个集合中
   /* public boolean if_subset(String item, List<String> entry_warehouseList){
        for(int i=0;i<entry_warehouseList.size();i++){
            if((!item.equals(entry_warehouseList.get(i)))){

            }
        }
        return true;
    }*/


    public static void main(String[] args) throws IOException, ParseException {
        /*List<String> entry_warehouseList=new ArrayList<String>();
        entry_warehouseList.add("123");
        entry_warehouseList.add("456");
        entry_warehouseList.add("789");
        //System.out.print(new Tool().if_subset("123",entry_warehouseList));
        System.out.print(entry_warehouseList.contains("1223"));*/

        /*File file = new File("D:\\spring\\log\\spring.log");  // Text文件 D:\spring\log\spring.log
        BufferedReader br = new BufferedReader(new FileReader(file));  // 构造一个BufferedReader类来读取文件
        String s = null;
        while ((s = br.readLine()) != null) {// 使用readLine方法，一次读一行
            System.out.println(s);
        }
        br.close();*/
       /* File file =new File("D:\\spring\\log\\spring.log");
        try {
            if(!file.exists()) {
                file.createNewFile();
            }
            FileWriter fileWriter =new FileWriter(file);
            fileWriter.write("");
            fileWriter.flush();
            fileWriter.close();
        } catch (IOException e) {
            e.printStackTrace();
        }*/
       /* // 使用format()方法将日期转换为指定格式的文本
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd HH:mm");
        SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        // 创建Date对象，表示当前时间
        Date now = new Date();

        // 调用format()方法，将日期转换为字符串并输出
        System.out.println(sdf1.format(now)                          );
        System.out.println(sdf3.format(java.util.Date.parse(sdf2.format(now))));
        System.out.println(sdf3.format(now));

        // 使用parse()方法将文本转换为日期
        String d = "2014-6-1 21:05:36";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        // 调用parse()方法，将字符串转换为日期
        Date date = sdf.parse(d);

        System.out.println(date);*/



    }

    public java.sql.Timestamp change_string_to_sql_timestamp(String time) throws ParseException {
        SimpleDateFormat format1 = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
        java.util.Date util_date=null;
        util_date=format1.parse(time);
        java.sql.Timestamp sql_timestamp=new java.sql.Timestamp(util_date.getTime());
        return sql_timestamp;
    }
}
